package com.myway.utils;

/**
 * @ClassName: ApproveException <br/>
 * @Description: Program to run the exception in the need for log records in the database <br/>
 * @CreateDate: 2016年4月27日 下午4:23:31 <br/>
 * @author Toby
 * @version V1.0
 */
public class ApproveException extends Exception {

	private static final long serialVersionUID = 2885320126348308325L;
	private ApproveError error;
	private String refundType;

	public String getRefundType() {
		return refundType;
	}

	public void setRefundType(String refundType) {
		this.refundType = refundType;
	}

	public ApproveError getError() {
		return error;
	}

	public void setError(ApproveError error) {
		this.error = error;
	}

	// public ApproveException(ApproveError error) {
	// super(error.name());
	// this.error = error;
	// }
	public ApproveException(ApproveError error, String refundType) {
		super(error.name());
		this.error = error;
		this.refundType = refundType;
	}

	public ApproveException(ApproveError error, Throwable ex) {
		super(error.name(), ex);
		this.error = error;
	}

	public enum ApproveError {
		IsNationTicket("国际票不可自动退"), 
		IsNotFullTicket("非全部退票不可自动退"), 
		Error4("航信数据无法同步"), 
		TaxIsWrong("税费不一致"), 
		RefundOrderIsWrong("退票订单解析错误,没有找到对应的订单类型"), 
		SystemError("系统错误"), 
		BuildParamError("拼装调用退票服务的参数发生异常"), 
		InvokeRefundError("调用退票服务方法发生错误"), 
		CabinError("仓位不可以进行自动退票"), 
		NotRefund("票面信息状态不是REFUND"),
		NotEXCHANGED("升仓票面信息状态不是NotEXCHANGED"), 
		HasFollowTicket("退票申请中含有联票"), 
		ManualTicket("手工退票不可以进行自动审核"), 
		MoreThanOneYear("订单时间大于一年"), 
		PayIsNotSame("支付金额与订单金额不相同"), 
		OrderStatIsNotCancelled("订单状态不是取消"),
		NotAllADT("包含非成人退票"),
		AnyDelay("无规则匹配"),
		Later("退票时间早于计划时间"),
		Overday("超过规则有效期"),
		ExceptionFlight("退票航班中存在例外航班"),
		CNN_over_baseDate("儿童自动退票超过销售有效期规则");

		String value;
		ApproveError(String value) {
			this.value = value;
		}
		public String value() {
			return value;
		}
	}

}
